#coding=utf-8
from django.conf.urls.defaults import *
from django.views.generic import list_detail
from models import type,source,unit,info

type_info = {
    "queryset" : type.objects.all().order_by("-id"),
    #"template_name" : "users/users_list.html",
    "paginate_by":8,
}

type_detail_info = {
    "queryset" : type.objects.all(),
    "template_object_name" : "type_info",
}

source_info = {
    "queryset" : source.objects.all().order_by("-id"),
    #"template_name" : "users/users_list.html",
    "paginate_by":8,
}

source_detail_info = {
    "queryset" : source.objects.all(),
    "template_object_name" : "type_info",
}

unit_info = {
    "queryset" : unit.objects.all().order_by("-id"),
    #"template_name" : "users/users_list.html",
    "paginate_by":8,
}

unit_detail_info = {
    "queryset" : unit.objects.all(),
    "template_object_name" : "unit_info",
}

customer_info = {
    "queryset" : info.objects.all().order_by("-id"),
    #"template_name" : "users/users_list.html",
    "paginate_by":8,
}

customer_detail_info = {
    "queryset" : info.objects.all(),
    "template_object_name" : "unit_info",
}

urlpatterns = patterns('',
    (r'^/?$', list_detail.object_list,customer_info),
    (r'^list/$', list_detail.object_list,customer_info),
    (r'^info/list/$', list_detail.object_list,customer_info),
    (r'^info/detail/(?P<object_id>\d+)/$',list_detail.object_detail,customer_detail_info),
    (r'^info/add/$','customer.views.customer_add'),
    (r'^info/modify/(?P<id>\d+)/$','customer.views.customer_modify'),
    (r'^info/delete/(?P<id>\d+)/$','customer.views.customer_delete'),
    (r'^info/delete/$','customer.views.customer_delete'),
    (r'^info/export/$','customer.views.customer_export'),
    (r'^info/import/$','customer.views.customer_import'),
    
    (r'^type/list/$', list_detail.object_list,type_info),
    (r'^type/detail/(?P<object_id>\d+)/$',list_detail.object_detail,type_detail_info),
    (r'^type/add/$','customer.views.type_add'),
    (r'^type/modify/(?P<id>\d+)/$','customer.views.type_modify'),
    (r'^type/delete/(?P<id>\d+)/$','customer.views.type_delete'),
    (r'^type/delete/$','customer.views.type_delete'),
    
    (r'^source/list/$', list_detail.object_list,source_info),
    (r'^source/detail/(?P<object_id>\d+)/$',list_detail.object_detail,source_detail_info),
    (r'^source/add/$','customer.views.source_add'),
    (r'^source/modify/(?P<id>\d+)/$','customer.views.source_modify'),
    (r'^source/delete/(?P<id>\d+)/$','customer.views.source_delete'),
    (r'^source/delete/$','customer.views.source_delete'),
    
    (r'^unit/list/$', list_detail.object_list,unit_info),
    (r'^unit/detail/(?P<object_id>\d+)/$',list_detail.object_detail,unit_detail_info),
    (r'^unit/add/$','customer.views.unit_add'),
    (r'^unit/modify/(?P<id>\d+)/$','customer.views.unit_modify'),
    (r'^unit/delete/(?P<id>\d+)/$','customer.views.unit_delete'),
    (r'^unit/delete/$','customer.views.unit_delete'),
)